@extends('layouts.app')
<style>
    #d2{
        display: none;
    }
</style>
@section('content')
    <span class="btn btn-warning pull-right" lay-submit lay-filter="login" id="span1">主播等级列表</span>
    <span class="btn btn-warning pull-right" lay-submit lay-filter="login" id="span2">直播等级添加</span>
    <div id="d1">
        <table class="layui-table">
            <thead>
            <tr>
                <th>
                    等级
                </th>
                <th>
                    等级名称
                </th>
                <th>
                    等级经验上限
                </th>
                <th>
                    图标
                </th>
                <th>
                    头像角标
                </th>
                <th>
                    发布时间
                </th>
                <th>
                    操作
                </th>
            </tr>
            </thead>
            <tbody>
            @foreach($info as $key=>$r)
                <tr>
                    <td>{{$r->grades}}</td>
                    <td>{{$r->grades_name}}</td>
                    <td>{{$r->grades_max}}</td>
                    <td><img src="{{$r->grades_image}}" alt="" width="50px" height="50px"></td>
                    <td><img src="{{$r->grades_images}}" alt="" width="50px" height="50px"></td>
                    <td>{{$r->grades_addtime}}</td>
                    <td><a href="grades_edit/{{$r->id}}">编辑</a>|<a href="grades_delete/{{$r->id}}">删除</a></td>
                </tr>
            @endforeach
            </tbody>
        </table>
    </div>
    <div id="d2">
        <form action="{{url('grades_insert')}}" method="post" enctype="multipart/form-data">
            {{csrf_field()}}
            <label class="login-title" for="username">等级</label>
            <div class="layui-form-item">
                <div class="layui-input-inline login-inline">
                    <input type="text" name="grades" lay-verify="required"  autocomplete="off" class="layui-input" value="0">
                </div>
            </div>
            <label class="login-title" for="username">等级名称</label>
            <div class="layui-form-item">
                <div class="layui-input-inline login-inline">
                    <input type="text" name="grades_name" lay-verify="required" id="c_time" autocomplete="off" class="layui-input" >
                </div>
            </div>
            <label class="login-title" for="username">等级经验上限</label>
            <div class="layui-form-item">
                <div class="layui-input-inline login-inline">
                    <input type="text" name="grades_max" lay-verify="required" id="c_time" autocomplete="off" class="layui-input" >
                </div>
            </div>
            <label class="login-title" for="username">图标</label>
            <div class="layui-form-item">
                <div class="layui-input-inline login-inline">
                    <input type="file" name="grades_image" lay-verify="required" id="c_time" autocomplete="off" class="layui-input" >
                </div>
            </div>
            <label class="login-title" for="username">头像角标</label>
            <div class="layui-form-item">
                <div class="layui-input-inline login-inline">
                    <input type="file" name="grades_images" lay-verify="required" id="c_time" autocomplete="off" class="layui-input" >
                </div>
            </div>
            <input type="submit" value="添加" class="btn btn-warning pull-right" lay-submit lay-filter="login">
            <span class="btn btn-warning pull-right" lay-submit lay-filter="login"><a href="{{url('mount_show')}}">返回</a></span>
        </form>
    </div>
@endsection
<script src="jquery.js"></script>
<script>
    $(document).on("click","#span2",function(){
        if($("#d2").css("display")=="none"){
            $("#d2").css("display","block");
            $("#d1").css("display","none");
        }else{
            $("#d2").css("display","none");
            $("#d1").css("display","block");
        }
    })
    $(document).on("click","#span1",function(){
        if($("#d1").css("display")=="none"){
            $("#d1").css("display","block");
            $("#d2").css("display","none");
        }else{
            $("#d1").css("display","none");
            $("#d2").css("display","block");
        }
    })
</script>